package com.yunjinsuke.recharge.entity;

import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.annotations.CreationTimestamp;
import org.hibernate.annotations.UpdateTimestamp;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import java.io.Serializable;
import java.util.Date;

/**
 * 基类
 */
@Data
@EqualsAndHashCode
@MappedSuperclass
public class BaseEntity implements Serializable {

    /**
     * 主键ID
     */
    @Id
    @Column(nullable = false,columnDefinition = "varchar(24) comment '主键ID'")
    private String id;

    /**
     * 创建时间
     */
    @Column(nullable = false,columnDefinition = "datetime(6) comment '创建时间'")
    @CreationTimestamp
    private Date createTime;

    /**
     * 修改时间
     */
    @Column(nullable = false,columnDefinition = "datetime(6) comment '修改时间'")
    @UpdateTimestamp
    private Date updateTime;
}
